#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class Solution
{
public:
    int hIndex(vector<int> &citations)
    {
        std::sort(citations.begin(), citations.end(), std::greater<int>());
        for (int i = 0; i < citations.size(); i++)
        {
            if (citations[i] < i + 1)
                return i;
        }
        return citations.size();
    }
};

int main()
{
    cout << "Code274" << endl;
    std::vector<int> citations = {3, 0, 6, 1, 5};
    Solution s;
    cout << s.hIndex(citations) << endl;
    return 0;
}